﻿//赋值仓库列表
function getHouseList() {
    var houseCode = $("#houseCode").val();
    var houseName = $("#houseName").val();
    layui.use(['laydate', 'laypage', 'layer', 'table', 'carousel', 'upload', 'element', 'slider'], function () {
        var laydate = layui.laydate //日期
            , laypage = layui.laypage //分页
            , layer = layui.layer //弹层
            , table = layui.table //表格
            , carousel = layui.carousel //轮播
            , upload = layui.upload //上传
            , element = layui.element //元素操作
            , slider = layui.slider //滑块


        //给table赋值
        table.render({
            elem: '#houseList'
            , height: 380
            //, width: 1030
            , url: '../Basis/getHouseList?houseName=' + houseName + '&houseCode=' + houseCode + '' //数据接口
            , title: '仓库表'
            , page: true //开启分页
            , even: true
            , limits: [20, 50, 80, 100]
            , toolbar:true //开启工具栏，此处显示默认图标，可以自定义模板，详见文档
            , defaultToolbar: ['print', 'exports']
            , cols: [[ //表头
                { type: 'checkbox', fixed: 'left' }
                , { field: 'houseCode', title: '仓库编号', width: 150, sort: true, fixed: 'left' }
                , { field: 'houseName', title: '仓库名称', width: 150 }
                , { field: 'accCode', title: '所属账套', width: 110 }
                , { field: 'isAccName', title: '同步数据', width: 110, sort: true }
                , { field: 'createTime', title: '创建时间', width: 180 }
                , { field: 'createUser', title: '创建人员', width: 150 }
            ]]
        });
    });
}

//同步仓库信息
function synchronous(type) {
    $.ajax({
        url: "../Basis/synchronousAll",
        data: JSON.stringify({ "type": type }),
        type: "post",
        success: function (data) {
            var json = JSON.parse(data);
            if (!json.result) {
                layer.msg(json.Msg);
            } else {
                layer.msg("同步完成");
            }
        }
    });
    getHouseList();
}